package com.ruoyi.system.domain.HUAWEI;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.system.domain.MES.KeymatBind;
import com.ruoyi.system.domain.MES.MaterialDatasDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * @author GE-LV5
 * @create 2023/4/10 14:34
 * 序列号物料追溯表
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName("EMS_BARCODE_RELATION")
public class EmsBarcodeRelation implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * po
     */
    @ApiModelProperty(value = "任务令或者工单号")
    @Excel(name = "任务令或者工单号")
    private String po;//

    /**
     * vendorId
     */
    @ApiModelProperty(value = "供应商编码")
    @Excel(name = "供应商编码")
    private Integer vendorId;//

    /**
     * orgId
     */
    @ApiModelProperty(value = "非能源默认157")
    @Excel(name = "非能源默认157")
    private Integer orgId;//

    /**
     * itemCode
     */
    @ApiModelProperty(value = "产品父项编码")
    @Excel(name = "产品父项编码")
    private String itemCode;//

    /**
     * barCode
     */
    @ApiModelProperty(value = "产品父项条码")
    @Excel(name = "产品父项条码")
    private String barCode;//

    /**
     * sonBarCode
     */
    @ApiModelProperty(value = "物料条码SN")
    @Excel(name = "物料条码SN")
    private String sonBarCode;


    /**
     * sonBarCode
     */
    @ApiModelProperty(value = "物料编码")
    @Excel(name = "物料编码")
    private String sonItemCode;
    /**
     * quantity
     */
    @ApiModelProperty(value = "实际子项物料数量")
    @Excel(name = "实际子项物料数量")
    private Double quantity;

    @ApiModelProperty(value = "供应商名称")
    @Excel(name = "供应商名称")
    private String supplier;
    /**
     * manufactory
     */
    @ApiModelProperty(value = "制造商名称")
    @Excel(name = "制造商名称")
    private String manufactory;


    /**
     * uploadFlag
     */
    @ApiModelProperty(value = "上载状态标志,默认为0.0-待上载,1-正在上载;2-上载成功;9-上载失败华为接口表返回校验信息")
    @Excel(name = "上载状态标志,默认为0.0-待上载,1-正在上载;2-上载成功;9-上载失败华为接口表返回校验信息")
    private Integer uploadFlag;//

    /**
     * checkMessage
     */
    @ApiModelProperty(value = "校验信息")
    @Excel(name = "校验信息")
    private String checkMessage;

    /**
     * createdBy
     */
    @ApiModelProperty(value = "创建人")
    @Excel(name = "创建人")
    private String createdBy;//

    /**
     * 采集时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "采集时间")
    @Excel(name = "采集时间")
    private Date createdDate;//

    /**
     * updatedBy
     */
    @ApiModelProperty(value = "更新人")
    @Excel(name = "更新人")
    private String updatedBy;//


    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    @Excel(name = "更新时间")
    private Date updatedDate;//

    /**
     * segment1
     */
    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private String segment1;//

    /**
     * segment2
     */
    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private String segment2;//

    /**
     * segment3
     */
    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private String segment3;

    /**
     * segment4
     */
    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private String segment4;

    /**
     * segment5
     */
    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private Integer segment5;//

    /**
     * segment6
     */
    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private Integer segment6;//

    /**
     * segment7
     */
    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private Date segment7;


    /**
     * itemId
     */
    @ApiModelProperty(value = "itemId")
    @Excel(name = "itemId")
    private Integer itemId;
    /**
     * sonItemId
     */
    @ApiModelProperty(value = "sonItemId")
    @Excel(name = "sonItemId")
    private Integer sonItemId;
    /**
     * sonItemId
     */
    @ApiModelProperty(value = "checkFlag")
    @Excel(name = "checkFlag")
    private Integer checkFlag;

    /**
     * emsTransId
     */
    private String emsTransId;//


    /**
     * checkInfo
     */
    private String checkInfo;

    /**
     * segment8
     */
    @ApiModelProperty(value = "segment8")
    @Excel(name = "segment8")
    private String segment8;

    /**
     * segment9
     */
    @ApiModelProperty(value = "segment9")
    @Excel(name = "segment9")
    private String segment9;

    /**
     * segment10
     */
    @ApiModelProperty(value = "segment10")
    @Excel(name = "segment10")
    private String segment10;//

    /**
     * segment11
     */
    @ApiModelProperty(value = "segment11")
    @Excel(name = "segment11")
    private String segment11;

    /**
     * segment12
     */
    @ApiModelProperty(value = "segment12")
    @Excel(name = "segment12")
    private String segment12;//

    /**
     * segment13
     */
    @ApiModelProperty(value = "segment13")
    @Excel(name = "segment13")
    private String segment13;

    /**
     * segment14
     */
    @ApiModelProperty(value = "segment14")
    @Excel(name = "segment14")
    private String segment14;

    /**
     * segment15
     */
    @ApiModelProperty(value = "segment15")
    @Excel(name = "segment15")
    private String segment15;

    /**
     * 绑定回传结果
     */
    @ApiModelProperty(value = "绑定回传结果")
    private String res;

    /**
     * 解绑回传结果
     */
    @ApiModelProperty(value = "解绑回传结果")
    private String resUntie;


    @ApiModelProperty(value = "采集开始时间")
    @Excel(name = "采集开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private Date beginTime;

    @ApiModelProperty(value = "采集结束时间")
    @Excel(name = "采集结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private Date endTime;


    public EmsBarcodeRelation(MaterialDatasDTO dto, KeymatBind keymatBind){
        this.vendorId = 22827731;
        this.orgId = 157;
        this.itemCode = keymatBind.getFProdCodeNo();
        this.barCode = keymatBind.getFNumber();
        this.sonBarCode = dto.getFMaterielBarcode();
        this.sonItemCode = dto.getFMaterielCode();
        this.quantity = 1D;
        this.uploadFlag = 0;
        this.createdBy = "LD001";
        this.createdDate = dto.getFDate();
        this.segment1 = "N";
        this.segment2 = "N";
        this.checkFlag = 0;
        this.segment10 = dto.getFMaterielCode();
        this.segment11 = keymatBind.getFProdCodeNo();
        this.segment14 = "1";
        this.segment15 = "EMS";
        this.createdDate = new Date();
    }

}
